(ns clj-8583.long-util
  (:import java.nio.ByteBuffer))


(defn long-to-bytes
  [number]
  (let [buff (ByteBuffer/allocate Long/BYTES)]
    (.putLong buff number)
    (.flip buff)
    (.array buff)))

(defn bytes-to-long
  [array-of-bytes]
  (let [buff (ByteBuffer/allocate Long/BYTES)]
    (.put buff array-of-bytes)
    (.flip buff)
    (.getLong buff)))
